]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st: Report correct paint volumes during transitions
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Jan 2011 20:15:05 +0000 (21:15 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Jan 2011 22:24:41 +0000 (23:24 +0100)
StWidget reports a paint volume large enough to paint the current
theme node. As CSS transitions also paint the previous theme node,
the reported paint volume may be incorrect, resulting in screen
artifacts when painting outside the reported volume.

Add st_theme_node_transition_get_paint_box() to calculate an allocation
large enough to paint both theme nodes, and use it to report the correct
paint volume during transitions.

https://bugzilla.gnome.org/show_bug.cgi?id=640085

src/st/st-theme-node-transition.c
src/st/st-theme-node-transition.h
src/st/st-widget.c

index ea1ba1c9e34ec23d4beb02350a74cbd6ace9df84..3da45ae050517f7d238be06209ae8d7300b1afa8 100644 (file)
@@ -182,6 +182,22 @@ st_theme_node_transition_update (StThemeNodeTransition *transition,
 static void
 calculate_offscreen_box (StThemeNodeTransition *transition,
                          const ClutterActorBox *allocation)
+{
+  ClutterActorBox paint_box;
+
+  st_theme_node_transition_get_paint_box (transition,
+                                          allocation,
+                                          &paint_box);
+  transition->priv->offscreen_box.x1 = paint_box.x1 - allocation->x1;
+  transition->priv->offscreen_box.y1 = paint_box.y1 - allocation->y1;
+  transition->priv->offscreen_box.x2 = paint_box.x2 - allocation->x1;
+  transition->priv->offscreen_box.y2 = paint_box.y2 - allocation->y1;
+}
+
+void
+st_theme_node_transition_get_paint_box (StThemeNodeTransition *transition,
+                                        const ClutterActorBox *allocation,
+                                        ClutterActorBox       *paint_box)
 {
   StThemeNodeTransitionPrivate *priv = transition->priv;
   ClutterActorBox old_node_box, new_node_box;
@@ -194,14 +210,10 @@ calculate_offscreen_box (StThemeNodeTransition *transition,
                                allocation,
                                &new_node_box);
 
-  priv->offscreen_box.x1 = MIN (old_node_box.x1, new_node_box.x1)
-                           - allocation->x1;
-  priv->offscreen_box.y1 = MIN (old_node_box.y1, new_node_box.y1)
-                           - allocation->y1;
-  priv->offscreen_box.x2 = MAX (old_node_box.x2, new_node_box.x2)
-                           - allocation->x1;
-  priv->offscreen_box.y2 = MAX (old_node_box.y2, new_node_box.y2)
-                           - allocation->y1;
+  paint_box->x1 = MIN (old_node_box.x1, new_node_box.x1);
+  paint_box->y1 = MIN (old_node_box.y1, new_node_box.y1);
+  paint_box->x2 = MAX (old_node_box.x2, new_node_box.x2);
+  paint_box->y2 = MAX (old_node_box.y2, new_node_box.y2);
 }
 
 static gboolean
index 3bcef9bebc8961ea586a2f0e124c1eea7c4b0332..d6fd9358a4d3753cca8de5bc8c4b7b1e39cbbc18 100644 (file)
@@ -65,6 +65,10 @@ void  st_theme_node_transition_paint    (StThemeNodeTransition *transition,
                                          ClutterActorBox       *allocation,
                                          guint8                 paint_opacity);
 
+void  st_theme_node_transition_get_paint_box (StThemeNodeTransition *transition,
+                                              const ClutterActorBox *allocation,
+                                              ClutterActorBox       *paint_box);
+
 G_END_DECLS
 
 #endif
index 8ebe1dd2728a004dfeb49eff55e6b71620cbbaab..71c1518f887c436675d7c8a0f7a1622813acd6bb 100644 (file)
@@ -686,15 +686,23 @@ st_widget_get_paint_volume (ClutterActor *self, ClutterPaintVolume *volume)
 {
   ClutterActorBox paint_box, alloc_box;
   StThemeNode *theme_node;
+  StWidgetPrivate *priv;
   ClutterVertex origin;
 
   /* Setting the paint volume does not make sense when we don't have any allocation */
   if (!clutter_actor_has_allocation (self))
     return FALSE;
 
+  priv = ST_WIDGET(self)->priv;
+
   theme_node = st_widget_get_theme_node (ST_WIDGET(self));
   clutter_actor_get_allocation_box (self, &alloc_box);
-  st_theme_node_get_paint_box (theme_node, &alloc_box, &paint_box);
+
+  if (priv->transition_animation)
+    st_theme_node_transition_get_paint_box (priv->transition_animation,
+                                            &alloc_box, &paint_box);
+  else
+    st_theme_node_get_paint_box (theme_node, &alloc_box, &paint_box);
 
   origin.x = paint_box.x1 - alloc_box.x1;
   origin.y = paint_box.y1 - alloc_box.y1;